package com.Enums;

import java.util.Random;

interface Item{
    /**
     * compete
     * @param it
     * @return
     */
    Outcome compete(Item it);

    /**
     * eval
     * @param p
     * @return
     */
    Outcome eval(Paper p);

    /**
     * eval
     * @param s
     * @return
     */
    Outcome eval(Scissor s);

    /**
     * eval
     * @param r
     * @return
     */
    Outcome eval(Rock r);
}
class Paper implements Item{
    @Override
    public Outcome compete(Item it){
        return it.eval(this);
    }

    @Override
    public Outcome eval(Paper p) {
        return Outcome.DRAW;
    }

    @Override
    public Outcome eval(Scissor s) {
        return Outcome.WIN;
    }
    @Override
    public Outcome eval(Rock r){
        return Outcome.LOSE;
    }

    @Override
    public String toString() {
        return "Paper";
    }
}
class Scissor implements Item{

    @Override
    public Outcome compete(Item it) {
        return it.eval(this);
    }

    @Override
    public Outcome eval(Paper p) {
        return Outcome.LOSE;
    }

    @Override
    public Outcome eval(Scissor s) {
        return Outcome.DRAW;
    }

    @Override
    public Outcome eval(Rock r){
        return Outcome.WIN;
    }

    @Override
    public String toString() {
        return "Scissors";
    }
}
class Rock implements Item{

    @Override
    public Outcome compete(Item it) {
        return it.eval(this);
    }


    @Override
    public Outcome eval(Paper p) {
        return Outcome.LOSE;
    }

    @Override
    public Outcome eval(Scissor s) {
        return Outcome.DRAW;
    }

    @Override
    public Outcome eval(Rock r) {
        return Outcome.WIN;
    }

    @Override
    public String toString() {
        return "Rock";
    }
}
/**
 * @author 13699
 */
public class RoShamBo1 {

    static final int SIZE=20;
    private static Random rand=new Random(47);

    public static Item newItem(){
        switch (rand.nextInt(3)){
            default:
            case 0:return new Scissor();
            case 1:return new Paper();
            case 2:return new Rock();
        }
    }
    public static void match(Item a,Item b){
        System.out.println(a+"vs."+b+":"+a.compete(b));
    }

    public static void main(String[] args) {
        for (int i = 0; i < SIZE; i++) {
            match(newItem(),newItem());
        }
    }
}
